package dto

import (
	"tuowei.com/app/admin/models"
	"tuowei.com/common/dto"
	common "tuowei.com/common/models"
)

type SysClassInsertReq struct {
	Id        int    `json:"id" comment:"主键ID"`
	Name      string `json:"name" comment:"班级名称" vd:"@:len($)>0; msg:'班级名称不能为空'"`
	ClassType string `json:"class_type" comment:"班级类型" vd:"@:len($)>0; msg:'请选择班级类型'"`
	Class     string `json:"class" comment:"班级分类" vd:"@:len($)>0; msg:'班级分类不能为空'"`
	//Province          int    `json:"province" comment:"省/市" vd:"$>0; msg:'请选择省份'"`
	//City              int    `json:"city" comment:"区/县" vd:"$>0; msg:'请选择城市'"`
	Count               int    `json:"count" comment:"班级人数"`
	DeptId              int    `json:"dept_id" comment:"教学点"`
	HeadMaster          int    `json:"head_master" comment:"班主任" vd:"$>0; msg:'请选择班主任'"`
	HeadMasterName      string `json:"head_master_name" comment:"班主任名称"`
	RegionalManagerId   int    `json:"regional_manager_id" comment:"大区经理ID"`
	RegionalManager     string `json:"regional_manager" comment:"大区经理"`
	CityLeaderId        int    `json:"city_leader_id" comment:"城市负责人ID"`
	CityLeader          string `json:"city_leader" comment:"城市负责人"`
	AdmissionsOfficerId int    `json:"admissions_officer_id" comment:"招生负责人ID"`
	AdmissionsOfficer   string `json:"admissions_officer" comment:"招生负责人"`
	common.ControlBy
}

func (s *SysClassInsertReq) Generate(model *models.SysClass) {
	//model.CourseId = s.CourseId
	model.Name = s.Name
	model.ClassType = s.ClassType
	model.Class = s.Class
	//model.Province = s.Province
	//model.City = s.City
	model.Count = s.Count
	model.DeptId = s.DeptId
	model.HeadMaster = s.HeadMaster
	model.HeadMasterName = s.HeadMasterName
	model.CityLeader = s.CityLeader
	model.CityLeaderId = s.CityLeaderId
	model.RegionalManager = s.RegionalManager
	model.RegionalManagerId = s.RegionalManagerId
	model.AdmissionsOfficer = s.AdmissionsOfficer
	model.AdmissionsOfficerId = s.AdmissionsOfficerId
	model.CreateBy = s.CreateBy
	model.Creator = s.Creator
}

func (s *SysClassInsertReq) GetId() interface{} {
	return s.Id
}

type SysClassGetPageReq struct {
	dto.Pagination `search:"-"`
	Name           string `form:"name" search:"type:exact;column:name;table:sys_class" comment:"班级名称"`
	HeadMaster     string `form:"head_master_name" search:"type:exact;column:head_master_name;table:sys_class" comment:"班主任"`
	Class          string `form:"class" search:"type:exact;column:class;table:sys_class" comment:"班级分类"`
	//DeptJoin       `search:"type:left;on:dept_id:dept_id;table:sys_class;join:sys_dept"`
}

func (m *SysClassGetPageReq) GetNeedSearch() interface{} {
	return *m
}

type SysClassUpdateReq struct {
	Id        int    `json:"id" comment:"主键ID" vd:"$>0;msg:'更新ID不能为空'"`
	Name      string `json:"name" comment:"班级名称" vd:"@:len($)>0;msg:'班级名称不能为空'"`
	ClassType string `json:"class_type" comment:"班级类型" vd:"@:len($)>0; msg:'请选择班级类型'"`
	Class     string `json:"class" comment:"班级分类" vd:"@:len($)>0; msg:'班级分类不能为空'"`
	//Province          int    `json:"province" comment:"省/市" vd:"$>0; msg:'请选择省份'"`
	//City              int    `json:"city" comment:"区/县" vd:"$>0; msg:'请选择城市'"`
	Count               int    `json:"count" comment:"班级人数"`
	DeptId              int    `json:"dept_id" comment:"教学点" vd:"$>0; msg:'请选择教学点'"`
	HeadMaster          int    `json:"head_master" comment:"班主任" vd:"$>0; msg:'请选择班主任'"`
	HeadMasterName      string `json:"head_master_name" comment:"班主任名称"`
	RegionalManagerId   int    `json:"regional_manager_id" comment:"大区经理ID"`
	RegionalManager     string `json:"regional_manager" comment:"大区经理"`
	CityLeaderId        int    `json:"city_leader_id" comment:"城市负责人ID"`
	CityLeader          string `json:"city_leader" comment:"城市负责人"`
	AdmissionsOfficerId int    `json:"admissions_officer_id" comment:"招生负责人ID"`
	AdmissionsOfficer   string `json:"admissions_officer" comment:"招生负责人"`
	common.ControlBy
}

func (s *SysClassUpdateReq) Generate(model *models.SysClass) {
	if s.Id != 0 {
		model.Id = s.Id
	}
	model.Name = s.Name
	model.ClassType = s.ClassType
	model.Class = s.Class
	model.Count = s.Count
	//model.Province = s.Province
	//model.City = s.City
	model.DeptId = s.DeptId
	model.HeadMaster = s.HeadMaster
	model.HeadMasterName = s.HeadMasterName
	model.CityLeader = s.CityLeader
	model.CityLeaderId = s.CityLeaderId
	model.RegionalManager = s.RegionalManager
	model.RegionalManagerId = s.RegionalManagerId
	model.AdmissionsOfficer = s.AdmissionsOfficer
	model.AdmissionsOfficerId = s.AdmissionsOfficerId
	model.UpdateBy = s.UpdateBy
	model.Updater = s.Updater
}

func (s *SysClassUpdateReq) GetId() interface{} {
	return s.Id
}

type SysClassById struct {
	dto.ObjectById
	common.ControlBy
}

type SysClassSearchReq struct {
	ClassType string `form:"class_type" search:"type:exact;column:class_type;table:sys_class" comment:"班级类型"`
	Name      string `form:"name" search:"type:contains;column:name;table:sys_class" comment:"根据班级名称搜索关键字"`
}

func (m *SysClassSearchReq) GetNeedSearch() interface{} {
	return *m
}

type MoveClassStudentReq struct {
	ClassId int   `json:"class_id" form:"class_id" binding:"required"` //班级id
	Id      []int `json:"id" form:"id" binding:"required"`             //学生id
}
